export default function() {
    return {
        data() {
            return {
                dialogChanelVisible: false,
                channelList: [],
                checkChannel: [],
                checkChannelName: ''
            }
        },
        methods: {
            showChannelDialog(){
                this.dialogChanelVisible = true;
            },
            openDialogChannel(){
                let channel = this.record.workChannelId;
                this.checkChannel = channel ? (typeof channel === 'string' ? JSON.parse(channel) : channel) : [];
            },
            handleCheckedChannelChange(value){   
                this.record.workChannelId = value;
                //表单显示处理
                if(value.length !== 0){
                    let tempStr = '';
                    value.forEach(item => {
                        this.workshopChannelList.forEach(item02 => {
                            if(item === item02.value){
                                tempStr+=`,${item02.label}`
                            }
                        })
                    });
                    this.record.workChannelName = tempStr.slice(1);
                }else {
                    this.record.workChannelName = ''
                }
            },
        }
    }
}